<?php

namespace App\Models;

use App\Models\Traits\BaseModels;
use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\HeaderMessage
 *
 * @property int $id
 * @property string $desc 说明
 * @property string $content 消息内容
 * @property string $valid_time 有效期
 * @property string|null $key_word 关键字
 * @property string $url 超链接
 * @property int $status 应用状态1应用2禁用
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HeaderMessage newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HeaderMessage newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HeaderMessage query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HeaderMessage whereContent($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HeaderMessage whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HeaderMessage whereDesc($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HeaderMessage whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HeaderMessage whereKeyWord($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HeaderMessage whereStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HeaderMessage whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HeaderMessage whereUrl($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HeaderMessage whereValidTime($value)
 * @mixin \Eloquent
 */
class HeaderMessage extends Model
{
    use BaseModels;

    /**
     * 应用
     */
    const STATUS_ON = 1;

    /**
     * 禁用
     */
    const STATUS_OFF = 2;

    /**
     * Description:url获取器
     * Author: Sam
     * DateTime: 2019-01-31 10:00
     * @param $value
     * @return string
     */
    public function getUrlAttribute($value)
    {
        return trim($value);
    }

    protected $fillable = [
        'desc',
        'content',
        'valid_time',
        'is_h5',
        'title',
        'url',
        'status'
    ];
}
